Optimal. Leaf size=97 \[ \frac {a x}{a^2+b^2}+\frac {b \log (\cos (c+d x))}{\left (a^2+b^2\right ) d}+\frac {a^4 \log (a+b \tan (c+d x))}{b^3 \left (a^2+b^2\right ) d}-\frac {a \tan (c+d x)}{b^2 d}+\frac {\tan ^2(c+d x)}{2 b d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.15, antiderivative size = 97, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 6, integrand size = 21, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.286, Rules used = {3647, 3728,
3708, 3698, 31, 3556} \begin {gather*} \frac {b \log (\cos (c+d x))}{d \left (a^2+b^2\right )}+\frac {a x}{a^2+b^2}+\frac {a^4 \log (a+b \tan (c+d x))}{b^3 d \left (a^2+b^2\right )}-\frac {a \tan (c+d x)}{b^2 d}+\frac {\tan ^2(c+d x)}{2 b d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 31
Rule 3556
Rule 3647
Rule 3698
Rule 3708
Rule 3728
Rubi steps
\begin {align*} \int \frac {\tan ^4(c+d x)}{a+b \tan (c+d x)} \, dx &=\frac {\tan ^2(c+d x)}{2 b d}+\frac {\int \frac {\tan (c+d x) \left (-2 a-2 b \tan (c+d x)-2 a \tan ^2(c+d x)\right )}{a+b \tan (c+d x)} \, dx}{2 b}\\ &=-\frac {a \tan (c+d x)}{b^2 d}+\frac {\tan ^2(c+d x)}{2 b d}+\frac {\int \frac {2 a^2+2 \left (a^2-b^2\right ) \tan ^2(c+d x)}{a+b \tan (c+d x)} \, dx}{2 b^2}\\ &=\frac {a x}{a^2+b^2}-\frac {a \tan (c+d x)}{b^2 d}+\frac {\tan ^2(c+d x)}{2 b d}+\frac {a^4 \int \frac {1+\tan ^2(c+d x)}{a+b \tan (c+d x)} \, dx}{b^2 \left (a^2+b^2\right )}-\frac {b \int \tan (c+d x) \, dx}{a^2+b^2}\\ &=\frac {a x}{a^2+b^2}+\frac {b \log (\cos (c+d x))}{\left (a^2+b^2\right ) d}-\frac {a \tan (c+d x)}{b^2 d}+\frac {\tan ^2(c+d x)}{2 b d}+\frac {a^4 \text {Subst}\left (\int \frac {1}{a+x} \, dx,x,b \tan (c+d x)\right )}{b^3 \left (a^2+b^2\right ) d}\\ &=\frac {a x}{a^2+b^2}+\frac {b \log (\cos (c+d x))}{\left (a^2+b^2\right ) d}+\frac {a^4 \log (a+b \tan (c+d x))}{b^3 \left (a^2+b^2\right ) d}-\frac {a \tan (c+d x)}{b^2 d}+\frac {\tan ^2(c+d x)}{2 b d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 0.45, size = 107, normalized size = 1.10 \begin {gather*} \frac {\frac {\log (i-\tan (c+d x))}{i a-b}-\frac {\log (i+\tan (c+d x))}{i a+b}+\frac {2 a^4 \log (a+b \tan (c+d x))}{b^3 \left (a^2+b^2\right )}-\frac {2 a \tan (c+d x)}{b^2}+\frac {\tan ^2(c+d x)}{b}}{2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.12, size = 92, normalized size = 0.95
method | result | size |
derivativedivides | \(\frac {-\frac {-\frac {b \left (\tan ^{2}\left (d x +c \right )\right )}{2}+a \tan \left (d x +c \right )}{b^{2}}+\frac {-\frac {b \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+a \arctan \left (\tan \left (d x +c \right )\right )}{a^{2}+b^{2}}+\frac {a^{4} \ln \left (a +b \tan \left (d x +c \right )\right )}{b^{3} \left (a^{2}+b^{2}\right )}}{d}\) | \(92\) |
default | \(\frac {-\frac {-\frac {b \left (\tan ^{2}\left (d x +c \right )\right )}{2}+a \tan \left (d x +c \right )}{b^{2}}+\frac {-\frac {b \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2}+a \arctan \left (\tan \left (d x +c \right )\right )}{a^{2}+b^{2}}+\frac {a^{4} \ln \left (a +b \tan \left (d x +c \right )\right )}{b^{3} \left (a^{2}+b^{2}\right )}}{d}\) | \(92\) |
norman | \(\frac {a x}{a^{2}+b^{2}}+\frac {\tan ^{2}\left (d x +c \right )}{2 b d}-\frac {a \tan \left (d x +c \right )}{b^{2} d}+\frac {a^{4} \ln \left (a +b \tan \left (d x +c \right )\right )}{b^{3} \left (a^{2}+b^{2}\right ) d}-\frac {b \ln \left (1+\tan ^{2}\left (d x +c \right )\right )}{2 d \left (a^{2}+b^{2}\right )}\) | \(101\) |
risch | \(-\frac {x}{i b -a}+\frac {2 i x \,a^{2}}{b^{3}}+\frac {2 i a^{2} c}{b^{3} d}-\frac {2 i x}{b}-\frac {2 i c}{b d}-\frac {2 i a^{4} x}{\left (a^{2}+b^{2}\right ) b^{3}}-\frac {2 i a^{4} c}{\left (a^{2}+b^{2}\right ) b^{3} d}+\frac {-2 i a \,{\mathrm e}^{2 i \left (d x +c \right )}+2 b \,{\mathrm e}^{2 i \left (d x +c \right )}-2 i a}{b^{2} d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{2}}-\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right ) a^{2}}{b^{3} d}+\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )}{b d}+\frac {a^{4} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {i b +a}{i b -a}\right )}{\left (a^{2}+b^{2}\right ) b^{3} d}\) | \(236\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.52, size = 99, normalized size = 1.02 \begin {gather*} \frac {\frac {2 \, a^{4} \log \left (b \tan \left (d x + c\right ) + a\right )}{a^{2} b^{3} + b^{5}} + \frac {2 \, {\left (d x + c\right )} a}{a^{2} + b^{2}} - \frac {b \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{2} + b^{2}} + \frac {b \tan \left (d x + c\right )^{2} - 2 \, a \tan \left (d x + c\right )}{b^{2}}}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 1.63, size = 134, normalized size = 1.38 \begin {gather*} \frac {2 \, a b^{3} d x + a^{4} \log \left (\frac {b^{2} \tan \left (d x + c\right )^{2} + 2 \, a b \tan \left (d x + c\right ) + a^{2}}{\tan \left (d x + c\right )^{2} + 1}\right ) + {\left (a^{2} b^{2} + b^{4}\right )} \tan \left (d x + c\right )^{2} - {\left (a^{4} - b^{4}\right )} \log \left (\frac {1}{\tan \left (d x + c\right )^{2} + 1}\right ) - 2 \, {\left (a^{3} b + a b^{3}\right )} \tan \left (d x + c\right )}{2 \, {\left (a^{2} b^{3} + b^{5}\right )} d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [C] Result contains complex when optimal does not.
time = 0.70, size = 677, normalized size = 6.98 \begin {gather*} \begin {cases} \tilde {\infty } x \tan ^{3}{\left (c \right )} & \text {for}\: a = 0 \wedge b = 0 \wedge d = 0 \\\frac {x + \frac {\tan ^{3}{\left (c + d x \right )}}{3 d} - \frac {\tan {\left (c + d x \right )}}{d}}{a} & \text {for}\: b = 0 \\- \frac {3 i d x \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} - 2 i b d} - \frac {3 d x}{2 b d \tan {\left (c + d x \right )} - 2 i b d} - \frac {2 \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )} \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} - 2 i b d} + \frac {2 i \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 b d \tan {\left (c + d x \right )} - 2 i b d} + \frac {\tan ^{3}{\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} - 2 i b d} + \frac {i \tan ^{2}{\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} - 2 i b d} + \frac {3 i}{2 b d \tan {\left (c + d x \right )} - 2 i b d} & \text {for}\: a = - i b \\\frac {3 i d x \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} + 2 i b d} - \frac {3 d x}{2 b d \tan {\left (c + d x \right )} + 2 i b d} - \frac {2 \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )} \tan {\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} + 2 i b d} - \frac {2 i \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 b d \tan {\left (c + d x \right )} + 2 i b d} + \frac {\tan ^{3}{\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} + 2 i b d} - \frac {i \tan ^{2}{\left (c + d x \right )}}{2 b d \tan {\left (c + d x \right )} + 2 i b d} - \frac {3 i}{2 b d \tan {\left (c + d x \right )} + 2 i b d} & \text {for}\: a = i b \\\frac {x \tan ^{4}{\left (c \right )}}{a + b \tan {\left (c \right )}} & \text {for}\: d = 0 \\\frac {2 a^{4} \log {\left (\frac {a}{b} + \tan {\left (c + d x \right )} \right )}}{2 a^{2} b^{3} d + 2 b^{5} d} - \frac {2 a^{3} b \tan {\left (c + d x \right )}}{2 a^{2} b^{3} d + 2 b^{5} d} + \frac {a^{2} b^{2} \tan ^{2}{\left (c + d x \right )}}{2 a^{2} b^{3} d + 2 b^{5} d} + \frac {2 a b^{3} d x}{2 a^{2} b^{3} d + 2 b^{5} d} - \frac {2 a b^{3} \tan {\left (c + d x \right )}}{2 a^{2} b^{3} d + 2 b^{5} d} - \frac {b^{4} \log {\left (\tan ^{2}{\left (c + d x \right )} + 1 \right )}}{2 a^{2} b^{3} d + 2 b^{5} d} + \frac {b^{4} \tan ^{2}{\left (c + d x \right )}}{2 a^{2} b^{3} d + 2 b^{5} d} & \text {otherwise} \end {cases} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 1.25, size = 100, normalized size = 1.03 \begin {gather*} \frac {\frac {2 \, a^{4} \log \left ({\left | b \tan \left (d x + c\right ) + a \right |}\right )}{a^{2} b^{3} + b^{5}} + \frac {2 \, {\left (d x + c\right )} a}{a^{2} + b^{2}} - \frac {b \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{2} + b^{2}} + \frac {b \tan \left (d x + c\right )^{2} - 2 \, a \tan \left (d x + c\right )}{b^{2}}}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 4.08, size = 109, normalized size = 1.12 \begin {gather*} \frac {{\mathrm {tan}\left (c+d\,x\right )}^2}{2\,b\,d}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )}{2\,d\,\left (b+a\,1{}\mathrm {i}\right )}-\frac {a\,\mathrm {tan}\left (c+d\,x\right )}{b^2\,d}+\frac {a^4\,\ln \left (a+b\,\mathrm {tan}\left (c+d\,x\right )\right )}{b^3\,d\,\left (a^2+b^2\right )}-\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,1{}\mathrm {i}}{2\,d\,\left (a+b\,1{}\mathrm {i}\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________